﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ManagementEffect.Engine;

namespace ManagementEffect
{
    public class Base_Effect 
    {
        public struct Item_Effect
        {
            public int ID { get; set; }
            public string Script { get; set; }
        }
        protected List<Item_Effect> danhsach = new List<Item_Effect>();
        public List<Item_Effect> DanhSach
        {
            get
            {
                return danhsach;
            }
        }
        #region IManagementEffect Members

        public virtual void Active(PythonEngine engine)
        {
            foreach (var item in danhsach)
            {
                try
                {
                    engine.SetCode(item.Script);
                    engine.Excute();
                }catch(Exception ex)
                {
                    Console.WriteLine("Error Script :" + ex.Message);
                    continue;
                }
            }
        }

        #endregion
    }
}
